import { Rule } from '@midwayjs/validate';
import { BaseDTO } from '../../../common/base.dto';
import { UserEntity } from '../entity/user';
import { R } from '../../../common/base.error.util';
import {
  requiredString,
  phone,
  string,
  email,
  array,
  number
} from '../../../common/common.validate.rules';

export class UserDTO extends BaseDTO<UserEntity> {
  @Rule(requiredString.error(R.validateError('用户名不能为空')))
  userName: string;
  @Rule(string)
  name: string;
  @Rule(string)
  nickName: string; 
  @Rule(phone)
  phone: string;
  @Rule(email)
  email: string;
  @Rule(string)
  remark: string;
  @Rule(array.items(number))
  roleList: string[];
}
